package com.shark.manager.system.entity;

import java.util.Date;

import org.apache.shiro.crypto.SecureRandomNumberGenerator;

import com.shark.commons.base.mapper.QuickSearch;
import com.shark.commons.utils.PropertyUtils;

public class User extends QuickSearch {
    private Long id;

    private String account;

    private String password;

    private String salt;

    private String truename;

    private String spell;

    private String gender;

    private Date birthday;

    private String mobile;

    private String telephone;

    private String email;

    private Integer loginCount;

    private Date recentsVisit;

    private Date lastVisit;

    private String remark;

    private Integer locked;

    private String iforgotSignature;

    private Date iforgotExpires;

    private Date changePassDate;

    private Date createTime;

    private String createUsername;

    private Date modifyTime;

    private String modifyUsername;
    
    
    /**
     * 项目加密盐
     */
    private static String AppSalt = PropertyUtils.getValue("shiro.applicationSalt");
    
    /**
     * 随机加密盐
     */
    public void setRandomSalt() {
    	setSalt(new SecureRandomNumberGenerator().nextBytes().toHex());
    }
    
    /**
     * 组合加密盐
     * 项目加密盐+用户名+随机岁加密盐
     * @return
     */
    public String getCredentialsSalt() {
    	if(null != getSalt()) {
    		return AppSalt + getSalt() ;
    	} 
    	return null;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    public String getTruename() {
        return truename;
    }

    public void setTruename(String truename) {
        this.truename = truename;
    }

    public String getSpell() {
        return spell;
    }

    public void setSpell(String spell) {
        this.spell = spell;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Integer getLoginCount() {
        return loginCount;
    }

    public void setLoginCount(Integer loginCount) {
        this.loginCount = loginCount;
    }

    public Date getRecentsVisit() {
        return recentsVisit;
    }

    public void setRecentsVisit(Date recentsVisit) {
        this.recentsVisit = recentsVisit;
    }

    public Date getLastVisit() {
        return lastVisit;
    }

    public void setLastVisit(Date lastVisit) {
        this.lastVisit = lastVisit;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Integer getLocked() {
        return locked;
    }

    public void setLocked(Integer locked) {
        this.locked = locked;
    }

    public String getIforgotSignature() {
        return iforgotSignature;
    }

    public void setIforgotSignature(String iforgotSignature) {
        this.iforgotSignature = iforgotSignature;
    }

    public Date getIforgotExpires() {
        return iforgotExpires;
    }

    public void setIforgotExpires(Date iforgotExpires) {
        this.iforgotExpires = iforgotExpires;
    }

    public Date getChangePassDate() {
        return changePassDate;
    }

    public void setChangePassDate(Date changePassDate) {
        this.changePassDate = changePassDate;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getCreateUsername() {
        return createUsername;
    }

    public void setCreateUsername(String createUsername) {
        this.createUsername = createUsername;
    }

    public Date getModifyTime() {
        return modifyTime;
    }

    public void setModifyTime(Date modifyTime) {
        this.modifyTime = modifyTime;
    }

    public String getModifyUsername() {
        return modifyUsername;
    }

    public void setModifyUsername(String modifyUsername) {
        this.modifyUsername = modifyUsername;
    }
}